package com.hangzhou.welbeing.welbeinginstrument.adapter;

import android.graphics.Bitmap;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.hangzhou.welbeing.welbeinginstrument.R;

import java.util.ArrayList;
import java.util.List;

/**
 * 时间 2017 年 09 月 16.
 * 作者 Administrator  刘传华
 * 公司 杭州惟君医疗科技有限公司
 * 包名 com.hangzhou.welbeing.pregnant.welbeing_pregnant.adapter
 * 工程名 welbeing_pregnant
 */
public class EditingAdapter extends RecyclerView.Adapter<EditingAdapter.ViewHolder> {
    private List<Bitmap> mlist = new ArrayList<>();
    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_editing_recyclerview,parent,false);
        ViewHolder viewHolder = new ViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.iv_image.setImageBitmap(mlist.get(position));
    }

    @Override
    public int getItemCount() {
        return mlist.size();
    }
    public void addItem(Bitmap content) {
        mlist.add(content);
       // notifyItemInserted(); //Attention!
        notifyDataSetChanged();
    }
    /**
     * 身体布局Holder
     */
    static class ViewHolder extends RecyclerView.ViewHolder {
        private ImageView iv_image;
        public ViewHolder(View itemView) {
            super(itemView);
            //iv_image =  (ImageView) itemView.findViewById(R.id.item_editing_recyclerview_iv_image);
        }
    }
}
